<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>事件递交系统</title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>media/js/ext/resources/css/ext-all.css" />
<style type="text/css" media="all">
    .allow-float {clear:none!important;} /* 允许该元素浮动 */
    .stop-float {clear:both!important;} /* 阻止该元素浮动 */
    .sex-male {float:left;}
    .sex-female {float:left;padding:0 0 0 20px;}
    .age-field {float:left;padding:0 0 0 58px;*padding:0 0 0 50px!important;*padding:0 0 0 50px;}
</style>
<script type="text/javascript" src="<?php echo base_url()?>media/js/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>media/js/ext/ext-all.js"></script>
</head>
<body id="body">
<?php
$re_user = (isset($_COOKIE['remuser']) ? $_COOKIE['remuser'] : '');
$re_pass = (isset($_COOKIE['rempass']) ? $_COOKIE['rempass'] : '');

?>

<script>
var username='<?=$re_user;?>';
var password='<?=$re_pass;?>';
var re_user='<?=$re_user;?>';
var re_pass='<?=$re_pass;?>';
var user_check;
var pass_check;
if(re_user!='')
	user_check=true;
else
	user_check=false;

if(re_pass!='')
	pass_check=true;
else
	pass_check=false;

Ext.onReady(function(){
 //使用表单提示
		  Ext.QuickTips.init();
          Ext.form.Field.prototype.msgTarget = 'side';

         var simple = new Ext.form.FormPanel({
    buttonAlign:'center',
    labelAlign:'right',
    labelWidth:40,
	animCollapse:true,
    frame:true,
	defaultType: 'textfield',//默认字段类型
    bodyStyle:'padding:8px 0 0 0;',
    items:[{
        xtype:'textfield',
        fieldLabel:'帐号',
        name:'username',
        id:'i_username',
		value:username,
		allowBlank:false,
		blankText: '用户名不能为空',
        width:150
    },
	{
        inputType:'password',
        fieldLabel:'密码',
        name:'password',
		value:password,
		allowBlank:false,
		blankText: '密码不能为空',
        id:'i_address',
        itemCls:'stop-float', //不允许浮动,结束控件横排
        width:150
    },
	{
        inputType:'dnypassword',
        fieldLabel:'密宝',
        name:'dnypassword',
		allowBlank:false,
		blankText: '密宝不能为空',
        id:'dny_address',
        itemCls:'stop-float', //不允许浮动,结束控件横排
        width:150
    },
	{
        xtype:'checkbox',
        fieldLabel:'快捷',
        boxLabel:'记住用户名',
        name:'RemberMe',
        id:'male',
        itemCls:'sex-male', //向左边浮动,处理控件横排
        clearCls:'stop-float', //允许两边浮动,在实际生成的HTML结构中有专门的DIV阻断浮动
        checked:user_check
    },{
        xtype:'checkbox',
		//fieldLabel:'记住密码:',
        boxLabel:'记住密码',
        name:'RemberMePass',
        id:'female',
        itemCls:'sex-female', //向左浮动,处理控件横排
        clearCls:'allow-float', //允许两边浮动
        hideLabel:true, //不显示前面"性别"的标签
		checked:pass_check
	}],
				buttons: [{
					text: '登录',
					type: 'submit',
					//定义表单提交事件
					handler:FormSubmit
				}],
				keys:[{
					key:Ext.EventObject.ENTER,
					fn:FormSubmit,
					scope:this
					}]
			});
			       //定义窗体
				   win = new Ext.Window({
						id:'win',
						title:'用户登录　　　【已加入统一用户平台】',
						layout:'fit',	//之前提到的布局方式fit，自适应布局
						width:280,
						height:210,
					//	autoHeight:true,
						plain:true,
                        bodyStyle:'padding:5px;',
						maximizable:false,//禁止最大化
						closeAction:'close',
						closable:false,//禁止关闭
						collapsible:true,//可折叠
						plain: true,
						buttonAlign:'center',
						items:simple//将表单作为窗体元素嵌套布局
					});
					win.show();//显示窗体
function FormSubmit(){
                        if(simple.form.isValid()){//验证合法后使用加载进度条
		      Ext.MessageBox.show({
				   title: '请稍等',
				   msg: '正在加载...',
				   progressText: '',
				   width:300,
				   progress:true,
				   closable:false,
				   animEl: 'loding'
			   });
			   //控制进度速度
			   var f = function(v){
				 return function(){
							var i = v/11;
							Ext.MessageBox.updateProgress(i, '');
			            };
			   };

			   for(var i = 1; i < 13; i++){
					setTimeout(f(i), i*150);
			   }

			  //提交到服务器操作
			  simple.form.doAction('submit',{
				 url:'<?php echo base_url()?>welcome/check',//文件路径
				 method:'post',//提交方法post或get
				 params:'',
				 //提交成功的回调函数
				 success:function(form,action){
						if (action.result.msg=='ok') {
							document.location='<?php echo base_url()?>welcome/admin';
						} else {
							Ext.Msg.alert('登录错误',action.result.msg);
						}
				 },
				 //提交失败的回调函数
				 failure:function(){
						Ext.Msg.alert('错误','服务器出现错误请稍后再试！');
				 }
			  });
		   }
}
		 });
</script>

</body>
</html>

